package com.code.design.model.demo.observer;

public class Client {

    public static void main(String[] args) {
        //初始化主角对象
        Hero hero = new Hero();
        //创建怪物对象
        Monster monster = new Monster();
        //创建陷阱对象
        Trap trap = new Trap();
        //创建宝物对象
        Treasure treasure = new Treasure();
        //注册观察者
        hero.attachObserver(monster);
        hero.attachObserver(trap);
        hero.attachObserver(treasure);
        //移动事件
        hero.move();
    }
}
